package br.com.social.mobile.daemon;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;

public class AppStartUp implements ServletContextListener{
	private Logger logger = Logger.getLogger(AppStartUp.class);
	 
    BDKeepAlive printTask = null;
 
    public void contextDestroyed(ServletContextEvent arg0) {
        // Do cleanup operations here
        printTask = null;
        logger.info("Cleanup activity: PrintTask instance set to null");
    }
 
    public void contextInitialized(ServletContextEvent arg0) {
        // Invoke the daemon/background process code
        printTask = new BDKeepAlive("Inicializando Daemon Keep BD Alive");
        printTask.invokeIndefinitePrintTask();
    }
 
}